package com.tiennt.android.chinesechess.models;

import java.util.ArrayList;

import com.tiennt.android.chinesechess.R;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class BitmapHolder {
	private Context context;

	public static class TenQuanCo {
		public static final int TOT_DO_NORMAL = 0;
		public static final int PHAO_DO_NORMAL = 1;
		public static final int XE_DO_NORMAL = 2;
		public static final int MA_DO_NORMAL = 3;
		public static final int TINH_DO_NORMAL = 4;
		public static final int SY_DO_NORMAL = 5;
		public static final int TUONG_DO_NORMAL = 6;

		public static final int TOT_DO_BIAN = 7;
		public static final int PHAO_DO_BIAN = 8;
		public static final int XE_DO_BIAN = 9;
		public static final int MA_DO_BIAN = 10;
		public static final int TINH_DO_BIAN = 11;
		public static final int SY_DO_BIAN = 12;
		public static final int TUONG_DO_BIAN = 13;

		public static final int TOT_DO_MARKED = 14;
		public static final int PHAO_DO_MARKED = 15;
		public static final int XE_DO_MARKED = 16;
		public static final int MA_DO_MARKED = 17;
		public static final int TINH_DO_MARKED = 18;
		public static final int SY_DO_MARKED = 19;
		public static final int TUONG_DO_MARKED = 20;

		public static final int TUONG_DO_BICHIEU = 21;

		public static final int TOT_DEN_NORMAL = 22;
		public static final int PHAO_DEN_NORMAL = 23;
		public static final int XE_DEN_NORMAL = 24;
		public static final int MA_DEN_NORMAL = 25;
		public static final int TINH_DEN_NORMAL = 26;
		public static final int SY_DEN_NORMAL = 27;
		public static final int TUONG_DEN_NORMAL = 28;

		public static final int TOT_DEN_BIAN = 29;
		public static final int PHAO_DEN_BIAN = 30;
		public static final int XE_DEN_BIAN = 31;
		public static final int MA_DEN_BIAN = 32;
		public static final int TINH_DEN_BIAN = 33;
		public static final int SY_DEN_BIAN = 34;
		public static final int TUONG_DEN_BIAN = 35;

		public static final int TOT_DEN_MARKED = 36;
		public static final int PHAO_DEN_MARKED = 37;
		public static final int XE_DEN_MARKED = 38;
		public static final int MA_DEN_MARKED = 39;
		public static final int TINH_DEN_MARKED = 40;
		public static final int SY_DEN_MARKED = 41;
		public static final int TUONG_DEN_MARKED = 42;

		public static final int TUONG_DEN_BICHIEU = 43;

		public static final int UP_DO = 44;
		public static final int UP_DO_MARKED = 45;

		public static final int UP_DEN = 46;
		public static final int UP_DEN_MARKED = 47;
	}

	private ArrayList<Bitmap> quanco;

	public BitmapHolder(Context context) {

		this.context = context;
		quanco = new ArrayList<Bitmap>();
		loadBitmapResource();
	}

	private void loadBitmapResource() {
		Resources resources = context.getResources();

		quanco.add(TenQuanCo.TOT_DO_NORMAL,
				BitmapFactory.decodeResource(resources, R.drawable.rchot));
		quanco.add(TenQuanCo.PHAO_DO_NORMAL,
				BitmapFactory.decodeResource(resources, R.drawable.rphao));
		quanco.add(TenQuanCo.XE_DO_NORMAL,
				BitmapFactory.decodeResource(resources, R.drawable.rxe));
		quanco.add(TenQuanCo.MA_DO_NORMAL,
				BitmapFactory.decodeResource(resources, R.drawable.rma));
		quanco.add(TenQuanCo.TINH_DO_NORMAL,
				BitmapFactory.decodeResource(resources, R.drawable.rtinh));
		quanco.add(TenQuanCo.SY_DO_NORMAL,
				BitmapFactory.decodeResource(resources, R.drawable.rsy));
		quanco.add(TenQuanCo.TUONG_DO_NORMAL,
				BitmapFactory.decodeResource(resources, R.drawable.rtuong));

		quanco.add(TenQuanCo.TOT_DO_BIAN,
				BitmapFactory.decodeResource(resources, R.drawable.rchot_bian));
		quanco.add(TenQuanCo.PHAO_DO_BIAN,
				BitmapFactory.decodeResource(resources, R.drawable.rphao_bian));
		quanco.add(TenQuanCo.XE_DO_BIAN,
				BitmapFactory.decodeResource(resources, R.drawable.rxe_bian));
		quanco.add(TenQuanCo.MA_DO_BIAN,
				BitmapFactory.decodeResource(resources, R.drawable.rma_bian));
		quanco.add(TenQuanCo.TINH_DO_BIAN,
				BitmapFactory.decodeResource(resources, R.drawable.rtinh_bian));
		quanco.add(TenQuanCo.SY_DO_BIAN,
				BitmapFactory.decodeResource(resources, R.drawable.rsy_bian));
		quanco.add(TenQuanCo.TUONG_DO_BIAN,
				BitmapFactory.decodeResource(resources, R.drawable.rtuong_bian));

		quanco.add(TenQuanCo.TOT_DO_MARKED, BitmapFactory.decodeResource(
				resources, R.drawable.rchot_marked));
		quanco.add(TenQuanCo.PHAO_DO_MARKED, BitmapFactory.decodeResource(
				resources, R.drawable.rphao_marked));
		quanco.add(TenQuanCo.XE_DO_MARKED,
				BitmapFactory.decodeResource(resources, R.drawable.rxe_marked));
		quanco.add(TenQuanCo.MA_DO_MARKED,
				BitmapFactory.decodeResource(resources, R.drawable.rma_marked));
		quanco.add(TenQuanCo.TINH_DO_MARKED, BitmapFactory.decodeResource(
				resources, R.drawable.rtinh_marked));
		quanco.add(TenQuanCo.SY_DO_MARKED,
				BitmapFactory.decodeResource(resources, R.drawable.rsy_marked));
		quanco.add(TenQuanCo.TUONG_DO_MARKED, BitmapFactory.decodeResource(
				resources, R.drawable.rtuong_marked));

		quanco.add(TenQuanCo.TUONG_DO_BICHIEU, BitmapFactory.decodeResource(
				resources, R.drawable.rtuong_bichieu));

		quanco.add(TenQuanCo.TOT_DEN_NORMAL,
				BitmapFactory.decodeResource(resources, R.drawable.bchot));
		quanco.add(TenQuanCo.PHAO_DEN_NORMAL,
				BitmapFactory.decodeResource(resources, R.drawable.bphao));
		quanco.add(TenQuanCo.XE_DEN_NORMAL,
				BitmapFactory.decodeResource(resources, R.drawable.bxe));
		quanco.add(TenQuanCo.MA_DEN_NORMAL,
				BitmapFactory.decodeResource(resources, R.drawable.bma));
		quanco.add(TenQuanCo.TINH_DEN_NORMAL,
				BitmapFactory.decodeResource(resources, R.drawable.btinh));
		quanco.add(TenQuanCo.SY_DEN_NORMAL,
				BitmapFactory.decodeResource(resources, R.drawable.bsy));
		quanco.add(TenQuanCo.TUONG_DEN_NORMAL,
				BitmapFactory.decodeResource(resources, R.drawable.btuong));

		quanco.add(TenQuanCo.TOT_DEN_BIAN,
				BitmapFactory.decodeResource(resources, R.drawable.bchot_bian));
		quanco.add(TenQuanCo.PHAO_DEN_BIAN,
				BitmapFactory.decodeResource(resources, R.drawable.bphao_bian));
		quanco.add(TenQuanCo.XE_DEN_BIAN,
				BitmapFactory.decodeResource(resources, R.drawable.bxe_bian));
		quanco.add(TenQuanCo.MA_DEN_BIAN,
				BitmapFactory.decodeResource(resources, R.drawable.bma_bian));
		quanco.add(TenQuanCo.TINH_DEN_BIAN,
				BitmapFactory.decodeResource(resources, R.drawable.btinh_bian));
		quanco.add(TenQuanCo.SY_DEN_BIAN,
				BitmapFactory.decodeResource(resources, R.drawable.bsy_bian));
		quanco.add(TenQuanCo.TUONG_DEN_BIAN,
				BitmapFactory.decodeResource(resources, R.drawable.btuong_bian));

		quanco.add(TenQuanCo.TOT_DEN_MARKED, BitmapFactory.decodeResource(
				resources, R.drawable.bchot_marked));
		quanco.add(TenQuanCo.PHAO_DEN_MARKED, BitmapFactory.decodeResource(
				resources, R.drawable.bphao_marked));
		quanco.add(TenQuanCo.XE_DEN_MARKED,
				BitmapFactory.decodeResource(resources, R.drawable.bxe_marked));
		quanco.add(TenQuanCo.MA_DEN_MARKED,
				BitmapFactory.decodeResource(resources, R.drawable.bma_marked));
		quanco.add(TenQuanCo.TINH_DEN_MARKED, BitmapFactory.decodeResource(
				resources, R.drawable.btinh_marked));
		quanco.add(TenQuanCo.SY_DEN_MARKED,
				BitmapFactory.decodeResource(resources, R.drawable.bsy_marked));
		quanco.add(TenQuanCo.TUONG_DEN_MARKED, BitmapFactory.decodeResource(
				resources, R.drawable.btuong_marked));

		quanco.add(TenQuanCo.TUONG_DEN_BICHIEU, BitmapFactory.decodeResource(
				resources, R.drawable.btuong_bichieu));

		quanco.add(TenQuanCo.UP_DO,
				BitmapFactory.decodeResource(resources, R.drawable.quanup_do));

		quanco.add(TenQuanCo.UP_DO_MARKED, BitmapFactory.decodeResource(
				resources, R.drawable.quanup_do_marked));

		quanco.add(TenQuanCo.UP_DEN,
				BitmapFactory.decodeResource(resources, R.drawable.quanup_den));

		quanco.add(TenQuanCo.UP_DEN_MARKED, BitmapFactory.decodeResource(
				resources, R.drawable.quanup_den_marked));

	}

	public Bitmap getBitmap(int quanco) {
		return this.quanco.get(quanco);
	}

}
